package com.share.tool.m2d.enums;

import lombok.Getter;

/**
 * @author syq
 * @data 2019/10/10
 */
@Getter
public enum DbEnum {
    TEST("test", "bbt_jd_dev_yra4_","mysql_es_datasyn","mysql_es_datasyn_2019"),//bbt_jd_pro_qlqs_xxxx数据库4个占位符，bbt_jd_member_xxx表名3个
    PROD("prod", "bbt_jd_pro_qlqs_","pro_mysql_read","pro_mysql_read_2019");

    final private String env;
    final private String tagName;
    final private String username;
    final private String password;

    private DbEnum(final String env, final String tagName,String username,String password) {
        this.env = env;
        this.tagName = tagName;
        this.username = username;
        this.password = password;
    }

    /**
     * 依据标签值获取枚举实例
     *
     * @return 标签枚举对象
     */
    public static DbEnum toEnum(final String env) {
        for (final DbEnum tag : DbEnum.values()) {
            if (tag.getEnv().equals(env)) {
                return tag;
            }
        }
        return null;
    }
}
